unit uFrmToshibaOPOSConfig;

interface

uses
  uPosCfg, OposLib, uPosGraspForm,
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, xwButtons, xwbasiccomponent, FZBase;

type
  TfrmToshibaOPOSConfig = class(TPosGraspForm)
    GroupBox1: TGroupBox;
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TFzxwBitbtn;
    GroupBox2: TGroupBox;
    Label2: TLabel;
    Edit2: TEdit;
    Button2: TFzxwBitbtn;
    CheckBox1: TCheckBox;
    FzxwBitbtn2: TFzxwBitbtn;
    FzxwBitbtn1: TFzxwBitbtn;
    procedure FormCreate(Sender: TObject);
    procedure FzxwBitbtn1Click(Sender: TObject);
    procedure FzxwBitbtn2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmToshibaOPOSConfig: TfrmToshibaOPOSConfig;

implementation

{$R *.dfm}

procedure TfrmToshibaOPOSConfig.FormCreate(Sender: TObject);
begin
  inherited FormCreate(Sender);
  InitialAllComponent();
  CheckBox1.Checked := PosConfig.IsToshibaOPOS;
  Edit1.Text := PosConfig.ToshibaOposDeviceName;
  Edit2.Text := PosConfig.ToshibaDispDeviceName;
end;

procedure TfrmToshibaOPOSConfig.FzxwBitbtn1Click(Sender: TObject);
begin
  ModalResult := mrCancel;
end;

procedure TfrmToshibaOPOSConfig.FzxwBitbtn2Click(Sender: TObject);
begin
  PosConfig.IsToshibaOPOS := CheckBox1.Checked;
  PosConfig.ToshibaOposDeviceName := Edit1.Text;
  PosConfig.ToshibaDispDeviceName := Edit2.Text;
  ModalResult := mrOk;
end;

procedure TfrmToshibaOPOSConfig.Button1Click(Sender: TObject);
begin
  OpenDrawer(Edit1.Text, False);
end;

procedure TfrmToshibaOPOSConfig.Button2Click(Sender: TObject);
begin
  DisplayLine(Edit2.Text, 'Toshiba OPOS', 'Test123456789', False);
end;

end.
